const fs = require('fs')
const path = require('path')
let data = fs.readFileSync('./info.json', 'utf-8')
console.log(data)

const arr = JSON.parse(data)
console.log(arr)
const sum= arr.reduce((pre, cur)=> {
    return pre+=cur.id
},0)
console.log(sum)

let random =arr[Math.floor(Math.random()*arr.length)]
console.log(random)
fs.writeFileSync('./info.json',sum+'')